<template>
  <div style="height: 100vh; display: flex; justify-content: space-between; align-items: center; margin: 0 10px;">
    <div style="flex-grow: 1; height: 40px;">
      <input type="text" v-model="name" placeholder="input your name" @keydown.enter="doEnter">
    </div>
    <div style="flex-shrink: 0; height: 40px; display: flex; justify-content: center; align-items: center;">
      <div class="enter-button" @click="doEnter">
        <span>ENTER</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'LoginView',
  data () {
    return {
      name: ''
    }
  },
  methods: {
    doEnter: function () {
      if (this.name.length <= 0) {
        alert('please enter your name')
      } else {
        this.$router.push({
          path: '/home',
          query: { name: this.name }
        })
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.enter-button {
  background-color: #42b983;
  width: 100px;
  height: 45px;
  margin-top: 6px;
  margin-left: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #fefefe;

  &:active {
    background-color: #eeeeee;
    color: #42b983;
  }
}

input {
  width: 100%;
  height: 40px;
}
</style>
